<?php 
//print_r($HttpResult);
if(1==2){$HttpResult = new HttpResult();}
	
	  $HttpContentResult = $HttpResult->getHttpContentResult();
	  //Debug::print_r($HttpResult);
	  //$lang = Config::DEFAULT_LOCALE;
		$head = new HtmlHeader($HttpContentResult->getHeader());
		$head->addCSS('reset');
		$head->addCSS('print','', 'print');
		$head->addCSS('ie',  'css/ie', 'print',true);
		
		$head->addCSS('forum',"css/admin");		
		
		//<!-- PROGRAMACAO JS | JQUERY  -->
		$head->addJS(array('jquery', 'masked'));
		
    //MENU DROPDOWN
    $head->addJS('Menu principal','js/menu/ddsmoothmenu');
    $head->addCSS('Menu CSS','js/menu/ddsmoothmenu');
    
    //TINYMCE
    $head->addJS('tinymce','js/tinymce/jquery.tinymce');
    
    //FILEUPLOAD
    $head->addJS('so','js/uploadify/swfobject');
    $head->addJS('uploadify','js/uploadify/jquery.uploadify.v2.1.4.min');
    $head->addCSS('Upload CSS','js/uploadify/uploadify');
		       
		//SLIDER SHOW
		$head->addJS('cycle', 'js/cycle/jquery.cycle.min');
	
		//<!-- JQUERY UI  -->
		$head->addJS('UI', 'js/UI/js/jquery-ui-1.8.6.custom.min');
		$head->addCSS('UI','js/UI/css/smoothness/jquery-ui-1.8.6.custom');
		
     //SELECTMENU
    $head->addJS('selectmenu','js/UI/development-bundle/ui/jquery.ui.selectmenu');
    $head->addCSS('selectmenu CSS','js/UI/css/jquery.ui.selectmenu');
    
		//<!-- VTIP  -->
		$head->addJS('vtip', 'js/vtip/vtip');
		$head->addCSS('vtip', 'js/vtip/vtip');
		
		//<!-- TABLE SORTER -->
		$head->addJS('tablesorter', 'js/tablesorter/tablesorter');
		$head->addCSS('tablesorter', 'js/tablesorter/tablesorter');
    
    //<!-- PROGRAMACAO JS | JQUERY  -->
    $head->addJS(array('admin','admin_select','banner_config'));
		
		$header_html = $head->show(TRUE);
$header_html = str_replace(array("democrart", "democrArt", "Democrart", "DemocrArt"), array("expressaoartistica", "Expressão Artística", "Expressão Artística", "Expressão Artística"), $header_html);
echo $header_html;
		
		include_once "library/democrart/modules/content/dao/ContentDemoDAO.class.php";
		include_once "library/facil3/core/modules/category/dao/CategoryDAO.class.php";
		include_once "library/e_commerce/modules/banner/vo/BannerConfigVO.class.php";
		$ContentDemoDAO = ContentDemoDAO::getInstance();
		$CategoryDAO = CategoryDAO::getInstance();
		
		$CategoryVO = new BannerConfigVO();
		
		$CategoryVO->setId(20, TRUE);
		$transitionType 			= $CategoryVO->getTransitionType();//o padrao é 2
		$transitionDelayTimeFixed 	= $CategoryVO->getTransitionDelayTimeFixed();

?>

<body>

<?php  include Config::getFolderView("parts/admin/header.php"); ?>
<div id="main"> 
	
<div id="main_content">
 <div id="config_banner_new">
   
     <h1>Configuração do banner</h1>
     <form action="" method="post" >
         
         <input type="hidden" value="true" name="auto" />
         <input type="hidden" value="false" name="text_panel" />
         <input type="hidden" value="false" name="text_panel" />
         <input type="hidden" value="fade" name="text_effect" />
         <input type="hidden" value="true" name="numbers" />
         <input type="hidden" value="inside" name="type" />
         <input type="hidden" value="top" name="timer_align" />
         <input type="hidden" value="fade" name="textboxEffect" />
         <br />
    <table>
        <tr>
            <td>
         <dl>
             <legend>Transição</legend>
             <label>Tipo</label>
             <select id="transitionType" name="transitionType">
                    <option selected="selected" value="random">aleatório</option>
                    <option value="none">nenhum</option>
                    <option value="fade">fade</option>
                    <option value="h.slide">horizontal slide</option>
                    <option value="v.slide">vertical slide</option>
                    <optgroup label="vertical stripes">
                        <option value="vert.random.fade">random fade</option>
                        <option value="vert.tl">top left</option>
                        <option value="vert.tr">top right</option>
                        <option value="vert.bl">bottom left</option>
                        <option value="vert.br">bottom right</option>	
                        <option value="fade.left">left fade</option>
                        <option value="fade.right">right fade</option>
                        <option value="alt.left">left alternating</option>
                        <option value="alt.right">right alternating</option>  
                        <option value="blinds.left">left blinds</option>
                        <option value="blinds.right">right blinds</option>
                    </optgroup>
                    <optgroup label="horizontal stripes">
                        <option value="horz.random.fade">random fade</option>
                        <option value="horz.tl">top left</option>
                        <option value="horz.tr">top right</option>
                        <option value="horz.bl">bottom left</option>	
                        <option value="horz.br">bottom right</option>	
                        <option value="fade.top">top fade</option> 
                        <option value="fade.bottom">bottom fade</option>
                        <option value="alt.top">top alternating</option>
                        <option value="alt.bottom">bottom alternating</option>
                        <option value="blinds.top">top blinds</option>
                        <option value="blinds.bottom">bottom blinds</option>
                    </optgroup>
                    <optgroup label="blocks">
                        <option value="diag.fade">diagional fade</option> 
                        <option value="diag.exp">diagional expand</option> 
                        <option value="rev.diag.fade">reverse diagional fade</option> 
                        <option value="rev.diag.exp">reverse diagional expand</option> 
                        <option value="block.fade">random fade</option> 
                        <option value="block.exp">random expand</option>	
                        <option value="block.drop">random drop</option>
                        <option value="spiral.in">spiral in</option>
                        <option value="spiral.out">spiral out</option> 
                        <option value="block.top.zz">top zig zag</option>
                        <option value="block.bottom.zz">bottom zig zag</option>
                        <option value="block.left.zz">left zig zag</option>
                        <option value="block.right.zz">right zig zag</option>
                        <option value="block.top">top expand</option>
                        <option value="block.bottom">bottom expand</option>
                        <option value="block.left">left expand</option>
                        <option value="block.right">right expand</option>
                    </optgroup>                        
                </select>
                
                <label>Tempo de espera (segundos):</label>
                <select id="transition_time" name="delay">
                    <option value="2000">2</option>
                    <option value="4000">4</option>
                    <option value="6000">6</option>
                    <option value="10000">10</option>
                    <option value="20000">20</option>
                    <option value="30000">30</option>
                    <option value="60000">60</option>
                </select>
         </dl>
    </td>
    <td>    
         <dl>
            <legend>Animação</legend>
            <label>Tipo:</label>
            <select id="easing" name="easing">
                <option value="none">none</option>
                <option value="linear">linear</option>
                <option value="easeInElastic">easeInElastic</option> 
                <option value="easeOutElastic">easeOutElastic</option> 
                <option value="easeInOutElastic">easeInOutElastic</option> 
                <option value="easeInBack">easeInBack</option> 
                <option value="easeOutBack">easeOutBack</option> 
                <option value="easeInOutBack">easeInOutBack</option> 
                <option value="easeInBounce">easeInBounce</option> 
                <option value="easeOutBounce">easeOutBounce</option> 
                <option value="easeInOutBounce">easeInOutBounce</option>                         
                <option value="easeInCirc">easeInCirc</option> 
                <option value="easeOutCirc">easeOutCirc</option> 
                <option value="easeInOutCirc">easeInOutCirc</option>  
                <option value="easeInQuad">easeInQuad</option> 
                <option value="easeOutQuad">easeOutQuad</option> 
                <option value="easeInOutQuad">easeInOutQuad</option> 
                <option value="easeInCubic">easeInCubic</option> 
                <option value="easeOutCubic">easeOutCubic</option> 
                <option value="easeInOutCubic">easeInOutCubic</option> 
                <option value="easeInQuart">easeInQuart</option> 
                <option value="easeOutQuart">easeOutQuart</option> 
                <option value="easeInOutQuart">easeInOutQuart</option> 
                <option value="easeInQuint">easeInQuint</option> 
                <option value="easeOutQuint">easeOutQuint</option> 
                <option value="easeInOutQuint">easeInOutQuint</option> 
                <option value="easeInSine">easeInSine</option> 
                <option value="easeOutSine">easeOutSine</option> 
                <option value="easeInOutSine">easeInOutSine</option> 
                <option value="easeInExpo">easeInExpo</option> 
                <option value="easeOutExpo">easeOutExpo</option> 
                <option value="easeInOutExpo">easeInOutExpo</option>
            </select>

            <label>Velocidade da animação (segundos):</label>
            <select id="transition_time" name="speed">
                <option value="500">0.5</option>
                <option value="800">0.8</option>
                <option value="1000">1</option>
                <option value="1200">1.2</option>
                <option value="1500">1.5</option>
                <option value="2000">2</option>
            </select>
         </dl>
    </td>
    <td>
         <dl>
             <legend>Tooltip & Botões</legend>
                <label>Tooltip</label>
                <select id="tt-type" name="tooltip">
                    <option selected="selected" value="image">image</option>
                    <option value="text">text</option>                        
                    <option value="none">none</option>
                </select>

                <label>Alinhamento dos botões</label>
                <select id="cpalignments" name="cpanel_align">
                    <option value="TL">top left</option>
                    <option value="TC">top center</option>
                    <option value="TR">top right</option>
                    <option value="BL">bottom left</option>
                    <option value="BC">bottom center</option>
                    <option selected="selected" value="BR">bottom right</option>
                </select>
         </dl>
    </td>
 </tr>
 <tr>
     <td>
         <dl>
             <legend>Ao mover o mouse sobre:</legend>
             <label>Ações</label>
               <div class="check-list">
                    <label for="pause-cb"><input type="checkbox" name="pause" id="pause-cb" />&nbsp;Pausar o banner</label>
                    <label for="cpanel-cb"><input type="checkbox" name="control_panel" id="cpanel-cb" />&nbsp;Exibir o painel de controle</label>
                </div>
          </dl>
     </td>
     <td>
         <dl>
            <legend>Mostrar:</legend>
            <div class="check-list">
                <label for="thumbs-cb"><input type="checkbox" checked="checked" id="thumbs-cb" name="buttons" />&nbsp;Botões de navegação</label>
                <label for="playbutton-cb"><input type="checkbox" checked="checked" name="play" id="playbutton-cb" />&nbsp;play</label>
                <label for="dbuttons-cb"><input type="checkbox" checked="checked" name="back_forward" id="dbuttons-cb" />&nbsp;Voltar | Avançar</label>
                <label for="timer-cb"><input type="checkbox" checked="checked" id="timer-cb" name="timer_bar" />&nbsp;Barra de tempo</label>
            </div>
         </dl>
       </td>
    </tr>
    </table>
         <br />
          <button class="btn config" type="submit">Salvar configurações</button>
      </form>

     </div>
    <button class="btn" type="button" id="btConfig">Configurar banner</button>
      <?php 

      if(isset($HttpContentResult->url_insert)){
        echo "<a href=\"{$HttpContentResult->url_insert}\" class=\"btn right btb\">Adicionar banner »</a>";
      } ?>
    
    <input id="category_id" type="hidden" value="<?php echo $this->category_id ?>" />
    
    <p class="success message">Você pode ordernar os itens da lista bastando, para tanto, arrastar a linha para a posição desejada!</p>
    
   	<table class="grid">
      <thead>
 <?php 
 	//Loop de fiels para as colunas da tabela - criando a primeira linha
 	echo "	<tr>";
	foreach($HttpContentResult->selectData->fields as $field){
 		if($field->visible == TRUE && $field->name != "go_to_location" ){
 			echo '	<th class="'.$field->type.'">';
 			//aqui é o título da tabela (coluna)
			echo $field->label;
			echo '	</th>';
		}
	}
	echo "		<th>Editar</th>";
	echo "		<th>Excluir</th>";
	echo "	</tr>";
  echo "</thead><tbody>";
	//loop de contents - linha a linha
	for($i = 0; $HttpContentResult->selectData->count_total>$i; $i++){
		//nova linha
		echo "<tr>";
		$edit 	= "";
 		$delete = "";
		foreach($HttpContentResult->selectData->fields as $field){
 			//varrendo as colunas - fields
				if($field->name == "id"){
					//se esse field dessa coluna for "id", 
					$id = $field->value[$i];
				}
		 		if($field->visible == TRUE){
		 			switch($field->type){
						case "simpleText":
		 					echo '<td>';
							echo $field->value[$i];
							echo '</td>';
							break;
							
						case "checkbox":
		 					echo '<td>';
							echo $field->value[$i];
							echo '</td>';
							break;	
						
						case "multiCheckbox":
							echo "";
							break;
							
						case "text":
							echo "";
							break;
						
						case "htmlText":
							echo "";
							echo "";
							break;
						
						case "date":
		 					echo '<td>';
							echo date("d-m-Y",strtotime($field->value[$i]));
							echo '</td>';
							break;
							
						case "url":
							
							$edit = "<td id=\"item$id\" class=\"ico one\" ><a href='".Config::getRootPath($field->value."/edit/id.".$id)."'><img src='". Config::getImagePath("icons/edit.jpg")  . "' alt='Editar' title='' /></a></td>";
							$delete = "<td class=\"ico one\"><a onclick=\"return confirm('Tem certeza que deseja excluir este item?');\" href='".Config::getRootPath($field->value."/delete/id.".$id)."'><img src='". Config::getImagePath("icons/delete.jpg")  ."' alt='Editar' title='' /></a></td>";
							break;
					}
		 		}
		 		
		}
		echo $edit;
		echo $delete;
		echo "</tr>";
	}
 ?>  
     </tbody>
		 </table> 

    </div>
    
</div>

<?php  include Config::getFolderView("parts/admin/footer.php"); ?>
